<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>添加文章</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style th:inline="text">
        body {
            background: url("asserts/img/bg5.jpg");
        }
    </style>
</head>
<body>

<div class="container">


    <div class="jumbotron text-center" style="background: #2E2D3C">
        <h2 style="font-family: 华文新魏;color: #fcfcfc;font-size: 50px">添加文章</h2>
    </div>

    <nav class="navbar navbar-inverse">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a style="font-family: 华文新魏;color: #c1e2b3;font-size: 28px" href="#" class="navbar-brand"
                   onclick="javascript:history.back(-1);">返回</a>
            </div>
            <div class="collapse navbar-collapse" id="myNavbar">
                <ul class="nav navbar-nav">
                    <!--                    <li><a href="#">页面 2</a></li>-->
                    <!--                    <li><a href="#">页面 3</a></li>-->
                </ul>
            </div>
        </div>
    </nav>


    <form style="font-family: 华文新魏;color: #2E2D3C;font-size: 25px" th:action="@{/saveArticle}" method="post"
          enctype="multipart/form-data" th:if="${ #strings.isEmpty(article.articleid)}">
        <input type="hidden" name="author" th:value="${author.username}">
        <input type="hidden" name="userid" th:value="${author.userid}">
        <input type="hidden" name="status" th:value="审核中">

        <div class="form-group">
            <label>请选择封面图</label>
            <input type="file" name="file">
        </div>
        <div class="form-group">
            <label>文章标题</label>
            <input type="text" class="form-control" name="title">
        </div>
        <div class="form-group">
            <label>文本框</label>
            <textarea class="form-control" rows="3" style="height: 250px" name="content"></textarea>
        </div>

        <button type="submit" class="btn btn-default">提交</button>

    </form>


    <!--修改文章回显-->
    <form th:action="@{/alterArticle}" method="post" enctype="multipart/form-data"
          th:if="${not #strings.isEmpty(article.articleid)}">
        <input type="hidden" name="author" th:value="${author.username}">
        <input type="hidden" name="userid" th:value="${author.userid}">
        <input type="hidden" name="status" th:value="审核中">
        <input type="hidden" name="articleid" th:value="${article.articleid}">


        <div class="form-group">
            <label>文章标题</label>
            <input type="text" class="form-control" name="title" th:value="${article.title}">
        </div>
        <div class="form-group">
            <label>文本框</label>
            <textarea class="form-control" rows="3" style="height: 500px" name="content"
                      th:text="${article.content}"></textarea>
        </div>

        <button type="submit" class="btn btn-default">提交</button>
    </form>


</div>

</body>
</html>